include('shared.lua')

function ENT:Initialize()
	self.Entity.Parent = self.Entity:GetNetworkedEntity("parent")

	while self.Entity.Parent:GetNetworkedString("damagetype") == nil do end
	self.Entity.DamageType = self.Entity.Parent:GetNetworkedString("damagetype")
	local colorvec = self.Entity.Parent:GetNetworkedVector("color")
	self.Entity.Color = Color(colorvec.x, colorvec.y, colorvec.z)
	
	if self.Entity.DamageType == "normal" then
		CDEffect_sprite_sustained(self.Entity, Vector(-20, 0, 0), self.Entity.Color, 50, 254, 6, true)
	elseif self.Entity.DamageType == "destructive" then
		CDEffect_sprite_sustained(self.Entity, Vector(-20, 0, 0), self.Entity.Color, 50, 100, 2, true)
		CDEffect_sprite_sustained(self.Entity, Vector(-20, 0, 0), self.Entity.Color, 50, 254, 3, true)
	elseif self.Entity.DamageType == "anti-shield" then
		CDEffect_sprite_sustained(self.Entity, Vector(-20, 0, 0), self.Entity.Color, 50, 200, 6, true)
		CDEffect_sprite_sustained(self.Entity, Vector(-20, 0, 0), self.Entity.Color, 100, 254, 7, true)
	end
end

function ENT:Draw() 
	if self.Entity:GetNetworkedBool("Drawmodel") then
		self.Entity:DrawModel()
	end
	CDEffect_client_processall(self.Entity)
end